import Mock from 'mockjs'
import { builder } from './util.js'

const Random = Mock.Random

const index = () => {
	return builder({
		banner: [{
			"sid": Random.integer(1, 1000),
			"img": Random.image('700x350')
		},{
			"sid": Random.integer(1, 1000),
			"img": Random.image('700x350')
		}],
		category: [[{
			"cat_id": Random.integer(1, 30),
			"img": Random.image('100x100'),
			"title": Mock.mock('@cname')
		},{
			"cat_id": Random.integer(1, 30),
			"img": Random.image('100x100'),
			"title": Mock.mock('@cname')
		},{
			"cat_id": Random.integer(1, 30),
			"img": Random.image('100x100'),
			"title": Mock.mock('@cname')
		},{
			"cat_id": Random.integer(1, 30),
			"img": Random.image('100x100'),
			"title": Mock.mock('@cname')
		},{
			"cid": Random.integer(1, 30),
			"img": Random.image('100x100'),
			"title": Mock.mock('@cname')
		}]],
		hot: [{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		},{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		},{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		}],
		goods: [{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Random.integer(1,1000),
			"name": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		},{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Random.integer(1,1000),
			"name": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		},{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Random.integer(1,1000),
			"name": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		},{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Random.integer(1,1000),
			"name": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		},{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Random.integer(1,1000),
			"name": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		},{
			"goods_id": Random.integer(1,1000),
			"img": Random.image('300x300'),
			"slogan": Random.integer(1,1000),
			"name": Mock.mock('@cname'),
			"price": Random.integer(300,9000)
		}]
	}, '', 1)
}

Mock.mock('http://localhost/api/index', 'get', index)